]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Do not use terms class variable after awaiting
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 17 Feb 2026 14:12:59 +0000 (15:12 +0100)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 17 Feb 2026 14:12:59 +0000 (15:12 +0100)
The terms may have been changed after awaiting, so rather than relying
on the local variable, just pass the value to the functions using them

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>

js/ui/search.js

index b96ec635c7de0189044df8e5a231aefeae8b65f7..334f1243ad074a7a9dd1d7e22f4bc020c4159b5d 100644 (file)
@@ -693,20 +693,21 @@ export const SearchResultsView = GObject.registerClass({
         provider.searchInProgress = true;
 
         let results = [];
+        const terms = this._terms;
         try {
             if (this._isSubSearch && previousResults) {
                 results = await provider.getSubsearchResultSet(
                     previousResults,
-                    this._terms,
+                    terms,
                     this._cancellable);
             } else {
                 results = await provider.getInitialResultSet(
-                    this._terms,
+                    terms,
                     this._cancellable);
             }
         } finally {
             this._results[provider.id] = results;
-            await this._updateResults(provider, results);
+            await this._updateResults(provider, terms, results);
         }
     }
 
@@ -854,8 +855,7 @@ export const SearchResultsView = GObject.registerClass({
         }
     }
 
-    async _updateResults(provider, results) {
-        const terms = this._terms;
+    async _updateResults(provider, terms, results) {
         const display = provider.display;
 
         try {